package com.jiulan.hearthearing.ui.login.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jiulan.hearthearing.R;

import java.util.List;

/**
 * 导航界面指示圆点的adapter
 */
public class GuideDianAdapter extends BaseQuickAdapter<Integer, BaseViewHolder> {

    private int mPosition = 0;

    public GuideDianAdapter(@Nullable List data) {
        super(R.layout.item_guide_dian, data);
    }

    public int getmPosition() {
        return mPosition;
    }

    public void setmPosition(int mPosition) {
        this.mPosition = mPosition;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(BaseViewHolder helper, Integer item) {
        ((ImageView) helper.getView(R.id.ivDian)).setImageDrawable(mContext.getResources().getDrawable((mPosition == helper.getPosition()) ? R.drawable.guide_point_selected : R.drawable.guide_point_normal));
    }
}
